package com.hsd.znsh.repository;

import com.hsd.znsh.entity.Sensor;
import com.hsd.znsh.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-04-23 11:54:50
 */
public interface SensorRepository extends JpaRepository<Sensor,Integer> {

    List<Sensor> findByHostIdIn(List<Integer> ids);

    List<Sensor> findByHostId(Integer hostId);

    List<Sensor> findByOnlineStatus(Integer onlineStatus);

    @Query("select sensorTypeId from Sensor where hostId=?1")
    List<Integer> findSensorTypeListByHostId(Integer hostId);

    List<Sensor> findByHostIdAndSensorTypeId(Integer hostId,Integer sensorTypeId);

    Sensor findBySensorSn(String sensorSn);

    Sensor findByFogId(String fogId);
}
